<?php

namespace app\model;

use think\Model;


//产品收藏表
class ProductLike extends Model
{
    // Define the table name
    protected $name = 'product_like';
    public $timestamps = false;

    public function product()
    {
        return $this->hasOne(Products::class,  'id','product_id');
    }


    // 获取用户收藏产品数量
    public function getAllProductLikeCount($uid){
        $count = $this->where('user_id',$uid)->count();
        return $count;
    }
}
